
package mdoc.ejbsample;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Table;
import javax.persistence.NamedQuery;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;

import java.util.*;

@Entity
@Table(name = "SEANCES", schema = "test")
@NamedQuery(name = "findAllSeances", query = "select s from Seance s")
public class Seance implements java.io.Serializable {
	private static final long serialVersionUID = -3L;

    @Id @GeneratedValue(strategy = GenerationType.AUTO)
	private int id;
    private Date horaire;
    private int places;

    @ManyToOne @JoinColumn(name = "salle_prog_id")
	private SalleProg salleprog;

	public int getId() {
		return id;
	}

	public Date getHoraire() {
		return horaire;
	}
    
    public SalleProg getProg() {
	return salleprog;
    }

    public void setHoraire(Date horaire) {
    	this.horaire = horaire;
    }
    
    public void setProg(SalleProg s){
	this.salleprog = s;
    }

	@Override public String toString() {
		StringBuilder sb = new StringBuilder();
		sb.append("Seance[id=").append(getId()).append(", horaire=").append(getHoraire()).append(", prog=").append(getProg()).append("]");
		return sb.toString();
	}

	public void setPlaces(int places) {
		this.places = places;
	}

	public int getPlaces() {
		return places;
	}
}
